<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:p="http://primefaces.org/ui"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <title>#{rotulos.labelHeaderCreateProject}</title>
        <link rel="stylesheet" type="text/css" href="../styles/basicPageStyle.css" />
        <script type="text/javascript">
        </script>
    </h:head>
    <h:body>
    <p:menubar>
    <p:menuitem value="Home" url="../views/home.jsf"/>
    <p:submenu label="#{rotulos.labelMenuMetricsCategories}" icon="ui-icon-document">
        <p:menuitem value="#{rotulos.labelConsultCategory}" url="../views/consultCategory.jsf"/>
    </p:submenu>
    <p:submenu label="#{rotulos.labelMenuMetrics}" icon="ui-icon-document">
        <p:menuitem value="#{rotulos.labelImportMetrics}" url="../views/registerMetric.jsf"/>
        <p:menuitem value="#{rotulos.labelConsultMetric}" url="../views/consultMetric.jsf" />
        
    </p:submenu>
    <p:submenu label="#{rotulos.labelMenuMetricProjects}" icon="ui-icon-document">
        <p:menuitem value="#{rotulos.labelHeaderCreateProject}" url="../views/createProject.jsf"/>
        <p:menuitem value="#{rotulos.labelConsultProject}" url="../views/consultProject.jsf"/>
    </p:submenu>
    
    <p:submenu label="#{rotulos.labelAdmin}" icon="ui-icon-document" rendered="#{userController.admin}">
        <p:menuitem value="#{rotulos.labelImportMetrics}" url="../admin/registerMetricAdmin.jsf"/>
        <p:menuitem value="#{rotulos.labelConsultMetric}" url="../admin/consultMetricAdmin.jsf"/>
        <p:menuitem value="#{rotulos.labelConsultUser}" url="../admin/consultUser.jsf"/>
        <p:menuitem value="#{rotulos.labelCreateCategory}" url="../admin/registerCategory.jsf"/>
        <p:menuitem value="#{rotulos.labelConsultCategory}" url="../admin/consultCategoryAdmin.jsf"/>
    </p:submenu>
    
            <f:facet name="options">
                <form action="/MetricTools/logoutServlet" method="get">
                    <h:commandButton type="submit" value="#{rotulos.labelLogout}"/>
                </form>
            </f:facet>
        </p:menubar>

        <center>
            <p:panel header="#{rotulos.labelHeaderCreateProject}" style="text-align:left;width:800px;" rendered="true">
                <h1>#{rotulos.labelHeaderCreateProject}</h1>
                <div >
                    <h:form id="project"  acceptcharset="ISO-8859-1">
                        <h:panelGrid cellpadding="5" columns="3">
                            <h:outputLabel value="#{rotulos.labelProjectName}" />
                            <h:inputText id="name" value="#{projectController.project.name}"
                                         required="true" requiredMessage="#{rotulos.labelMessageNameEmpty}"
                                         styleClass="comboStyle"
                                         >
                            </h:inputText><br/>

                            <h:outputLabel value="#{rotulos.labelProjectPurpose}" />
                            <h:inputText id="purpose" value="#{projectController.project.purpose}" styleClass="comboStyle"
                                         required="true" requiredMessage="#{rotulos.labelMessageNameEmpty}"
                                         >
                            </h:inputText><br/>
                            <p:commandButton value="#{rotulos.register}" ajax="false" actionListener="#{projectController.saveProject()}" style="text-align: right" update=":treeArchive"/>    	
                        </h:panelGrid>
                    </h:form>
                    <h:form>
                        <p:fileUpload fileUploadListener="#{fileUploadController.upload}" 
                                  mode="advanced" 
                                  update="messages,:treeArchive,:ar"
                                  sizeLimit="10000000" 
                                  allowTypes="/(\.|\/)(zip)$/"/>

                    <p:growl id="messages" showDetail="true"/>
                    </h:form>
                    <br/>
                </div>
            </p:panel>
            <p:dataTable id="ar" var="archive" value="#{fileUploadController.listArchive}" style="text-align:left;width:800px;" rendered="#{projectController.display}">
                    <p:column>
                            <f:facet name="header">
                                <h:outputText value="Name"/>
                            </f:facet>
                        <h:outputText value="#{archive.name}" />
                    </p:column>
                    <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{rotulos.category}"/>
                            </f:facet>
                            <p:selectOneMenu value="#{projectController.selectCategory}" id="category" styleClass="comboStyle">
                                <f:selectItem itemValue="" itemLabel="#{rotulos.textSelectCategory}"/>
                                <f:selectItems value="#{registerController.category}"/>
                            </p:selectOneMenu><br/>
                     </p:column>

                </p:dataTable>
            
            <p:panel style="text-align:left;width:700px;" rendered="false" >
                <p>#{rotulos.labelChooseFile}</p>
                <br/>
                <br/>
                <p:tree id="treeArchive" value="#{projectController.root}" var="archive" style="width: 100%;text-align: left" selectionMode="single" cache="false">

                    <p:treeNode type="default" expandedIcon="ui-icon-folder-open" 
                                collapsedIcon="ui-icon-folder-collapsed">  
                        <h:outputText id="root" value="#{archive}"/> 
                    </p:treeNode>

                    <p:treeNode type="picture" id="name" icon="ui-icon-document">  
                        <h:outputText value="#{archive}"/> 
                    </p:treeNode>
                </p:tree>
            </p:panel>
        </center>
    </h:body>
</html>
